﻿using System;
using System.Collections.Generic;
using System.Text;
using Basic.Model.Entity;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;

namespace Basic.Model.EntityManager
{
    public class BasicHashTableManager
    {
        public static void Add(ISession session, BasicHashTable an)
        {
            session.Save(an);
        }

        public static void Delete(ISession session, BasicHashTable an)
        {
            session.Delete(an);
        }

        public static void Update(ISession session, BasicHashTable an)
        {
            session.Update(an);
        }

        public static BasicHashTable Get(ISession session, string hashTableName)
        {
            ICriteria c = session.CreateCriteria(typeof(BasicHashTable));
            c.Add(Expression.Eq("hashTableName", hashTableName));
            return c.UniqueResult<BasicHashTable>();
        }
    }
}